package com.vancouver.knows.ui.activity.citydiscount;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.vancouver.knows.R;
import com.vancouver.knows.ui.base.BaseActivity;
import com.vancouver.knows.ui.fragment.my.NewUserFragment;
import com.vancouver.knows.util.AppUtils;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by llf on 2017/3/24.
 */

public class QrCodeActivity extends BaseActivity {

    private Context activity;
    @Bind(R.id.common_tips)
    TextView commonTips;
    @Bind(R.id.common_back)
    ImageView commonBack;
    @Bind(R.id.qr_code)
    ImageView qrCode;

   // @Bind(R.id.instructions)
   // TextView instructions;
    @Bind(R.id.check_all_welfare)
    TextView checkAll;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_promotion_qr_code);
        activity = QrCodeActivity.this;
        setViews();
    }

    private void setViews() {
        commonTips.setText(imContext.getString(R.string.qr_code_title));

      //  Intent intent = getIntent();
       // String instruction = intent.getStringExtra("QR_CODE_INSTRUCTION");
        //instructions.setText(instruction);
        String bitmapStr = AppUtils.createQrImage(this);
        Bitmap bitmap = AppUtils.convertStringToIcon(bitmapStr);
        if (bitmap != null)
            qrCode.setImageBitmap(bitmap);
    }

    @OnClick(R.id.check_all_welfare)
    public void OnCheckAllWelfareClick(){
        NewUserFragment.showCityDiscountTab();
        OnCommonBackClick();

    }
    @OnClick(R.id.common_back)
    public void OnCommonBackClick() {
        finish();
    }

}
